import instance from '@/util/http'
/**
 * 优惠券添加
 **/
export const addCoupon = (data: any) => instance.post('/market/coupon/add', data)
/**
 * 优惠券更新
 **/
export const updateCoupon = (data: any) => instance.put('/market/coupon/update', data)
/**
 * 优惠券分页
 **/
export const pageCoupon = (data: any) => instance.post('/market/coupon/page', data)
/**
 * 优惠券删除
 **/
export const deleteCoupon = (id: string) => instance.delete('/market/coupon/delete/' + id)
/**
 * 优惠券详情
 **/
export const detailCoupon = (id: string) => instance.get('/market/coupon/detail/' + id)
/**
 * 优惠券绑定商品
 **/
export const couponAddGoods = (id: string, data: any) => instance.post('/market/coupon/addGoods/' + id, data)
/**
 * 优惠券得到绑定商品
 **/
export const getCheckedGoods = (id: string) => instance.get('/market/coupon/getGoods/' + id)
/**
 * 添加推广
 */
export const addAd = async (data: any) => instance.post('/market/ad/add', data)
/**
 * 更新推送广告
 */
export const updateAd = async (data: any) => instance.put('/market/ad/update', data)
/**
 * 获取推送广告列表
 */
export const pageAd = async (data: any) => instance.post('/market/ad/page', data)
/**
 * 删除推送广告
 */
export const deleteAd = async (id: string) => instance.delete('/market/ad/delete/' + id)
/**
 * 获取推送广告详细信息
 */
export const detailAd = async (id: string) => instance.get('/market/ad/detail/' + id)
/**
 * 得到广告select
 */
export const getAdSelect = async (allData: boolean, name: string) => instance.get('/market/ad/getSelect/' + allData, { name: name })
/**
 * 获取枚举list
 */
export const getEnumList = (name: string) => instance.get('/market/enum/getList/' + name)
/**
 * 添加推广文件
 * @param data
 * @returns
 */
export const addAdFile = (data: any) => instance.post('/market/ad/file/add', data)
/**
 * 更新推广文件
 * @param data
 * @returns
 */
export const updataAdFile = (data: any) => instance.put('/market/ad/file/update', data)
/**
 * 推广文件分页
 * @param data
 * @returns
 */
export const AdFilePage = (data: any) => instance.post('/market/ad/file/page', data)
/**
 * 删除推广文件
 * @param id
 * @returns
 */
export const AdFileDelete = (id: string) => instance.delete('/market/ad/file/delete/' + id)
/**
 * 推广文件详情
 * @param id
 * @returns
 */
export const AdFileDetail = (id: string) => instance.get('/market/ad/file/detail/' + id)
